{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# Logistic 回归 -- 租房意向预测"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 导入必要模块\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "from sklearn.model_selection import GridSearchCV\n",
    "\n",
    "# 竞赛的评价指标为 logloss\n",
    "from sklearn.metrics import log_loss\n",
    "\n",
    "from matplotlib import pyplot\n",
    "import seaborn as sns\n",
    "%matplotlib inline\n",
    "pd.set_option('display.float_format', lambda x: '%.3f' % x)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 读入数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "train = pd.read_csv('RentListingInquries_FE_train.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "test = pd.read_csv('RentListingInquries_FE_test.csv')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 数据探索"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>bathrooms</th>\n",
       "      <th>bedrooms</th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "      <th>price</th>\n",
       "      <th>price_bathrooms</th>\n",
       "      <th>price_bedrooms</th>\n",
       "      <th>room_diff</th>\n",
       "      <th>room_num</th>\n",
       "      <th>Year</th>\n",
       "      <th>...</th>\n",
       "      <th>walk</th>\n",
       "      <th>walls</th>\n",
       "      <th>war</th>\n",
       "      <th>washer</th>\n",
       "      <th>water</th>\n",
       "      <th>wheelchair</th>\n",
       "      <th>wifi</th>\n",
       "      <th>windows</th>\n",
       "      <th>work</th>\n",
       "      <th>interest_level</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1.500</td>\n",
       "      <td>3</td>\n",
       "      <td>40.715</td>\n",
       "      <td>-73.942</td>\n",
       "      <td>3000</td>\n",
       "      <td>1200.000</td>\n",
       "      <td>750.000</td>\n",
       "      <td>-1.500</td>\n",
       "      <td>4.500</td>\n",
       "      <td>2016</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1.000</td>\n",
       "      <td>2</td>\n",
       "      <td>40.795</td>\n",
       "      <td>-73.967</td>\n",
       "      <td>5465</td>\n",
       "      <td>2732.500</td>\n",
       "      <td>1821.667</td>\n",
       "      <td>-1.000</td>\n",
       "      <td>3.000</td>\n",
       "      <td>2016</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1.000</td>\n",
       "      <td>1</td>\n",
       "      <td>40.739</td>\n",
       "      <td>-74.002</td>\n",
       "      <td>2850</td>\n",
       "      <td>1425.000</td>\n",
       "      <td>1425.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>2.000</td>\n",
       "      <td>2016</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1.000</td>\n",
       "      <td>1</td>\n",
       "      <td>40.754</td>\n",
       "      <td>-73.968</td>\n",
       "      <td>3275</td>\n",
       "      <td>1637.500</td>\n",
       "      <td>1637.500</td>\n",
       "      <td>0.000</td>\n",
       "      <td>2.000</td>\n",
       "      <td>2016</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1.000</td>\n",
       "      <td>4</td>\n",
       "      <td>40.824</td>\n",
       "      <td>-73.949</td>\n",
       "      <td>3350</td>\n",
       "      <td>1675.000</td>\n",
       "      <td>670.000</td>\n",
       "      <td>-3.000</td>\n",
       "      <td>5.000</td>\n",
       "      <td>2016</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 225 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   bathrooms  bedrooms  latitude  longitude  price  price_bathrooms  \\\n",
       "0      1.500         3    40.715    -73.942   3000         1200.000   \n",
       "1      1.000         2    40.795    -73.967   5465         2732.500   \n",
       "2      1.000         1    40.739    -74.002   2850         1425.000   \n",
       "3      1.000         1    40.754    -73.968   3275         1637.500   \n",
       "4      1.000         4    40.824    -73.949   3350         1675.000   \n",
       "\n",
       "   price_bedrooms  room_diff  room_num  Year       ...        walk  walls  \\\n",
       "0         750.000     -1.500     4.500  2016       ...           0      0   \n",
       "1        1821.667     -1.000     3.000  2016       ...           0      0   \n",
       "2        1425.000      0.000     2.000  2016       ...           0      0   \n",
       "3        1637.500      0.000     2.000  2016       ...           0      0   \n",
       "4         670.000     -3.000     5.000  2016       ...           0      0   \n",
       "\n",
       "   war  washer  water  wheelchair  wifi  windows  work  interest_level  \n",
       "0    0       0      0           0     0        0     0               1  \n",
       "1    0       0      0           0     0        0     0               2  \n",
       "2    0       0      0           0     0        0     0               0  \n",
       "3    0       0      0           0     0        0     0               2  \n",
       "4    1       0      0           0     0        0     0               2  \n",
       "\n",
       "[5 rows x 225 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 49352 entries, 0 to 49351\n",
      "Columns: 225 entries, bathrooms to interest_level\n",
      "dtypes: float64(7), int64(218)\n",
      "memory usage: 84.7 MB\n"
     ]
    }
   ],
   "source": [
    "train.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>bathrooms</th>\n",
       "      <th>bedrooms</th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "      <th>price</th>\n",
       "      <th>price_bathrooms</th>\n",
       "      <th>price_bedrooms</th>\n",
       "      <th>room_diff</th>\n",
       "      <th>room_num</th>\n",
       "      <th>Year</th>\n",
       "      <th>...</th>\n",
       "      <th>walk</th>\n",
       "      <th>walls</th>\n",
       "      <th>war</th>\n",
       "      <th>washer</th>\n",
       "      <th>water</th>\n",
       "      <th>wheelchair</th>\n",
       "      <th>wifi</th>\n",
       "      <th>windows</th>\n",
       "      <th>work</th>\n",
       "      <th>interest_level</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>...</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "      <td>49352.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>1.212</td>\n",
       "      <td>1.542</td>\n",
       "      <td>40.742</td>\n",
       "      <td>-73.956</td>\n",
       "      <td>3830.174</td>\n",
       "      <td>1697.863</td>\n",
       "      <td>1657.567</td>\n",
       "      <td>-0.329</td>\n",
       "      <td>2.754</td>\n",
       "      <td>2016.000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.003</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.186</td>\n",
       "      <td>0.009</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.028</td>\n",
       "      <td>0.002</td>\n",
       "      <td>0.001</td>\n",
       "      <td>0.001</td>\n",
       "      <td>1.617</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.501</td>\n",
       "      <td>1.115</td>\n",
       "      <td>0.639</td>\n",
       "      <td>1.178</td>\n",
       "      <td>22066.866</td>\n",
       "      <td>11004.769</td>\n",
       "      <td>7817.996</td>\n",
       "      <td>0.948</td>\n",
       "      <td>1.446</td>\n",
       "      <td>0.000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.055</td>\n",
       "      <td>0.020</td>\n",
       "      <td>0.389</td>\n",
       "      <td>0.102</td>\n",
       "      <td>0.021</td>\n",
       "      <td>0.165</td>\n",
       "      <td>0.045</td>\n",
       "      <td>0.032</td>\n",
       "      <td>0.031</td>\n",
       "      <td>0.626</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>-118.271</td>\n",
       "      <td>43.000</td>\n",
       "      <td>21.500</td>\n",
       "      <td>43.000</td>\n",
       "      <td>-5.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>2016.000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>1.000</td>\n",
       "      <td>1.000</td>\n",
       "      <td>40.728</td>\n",
       "      <td>-73.992</td>\n",
       "      <td>2500.000</td>\n",
       "      <td>1225.000</td>\n",
       "      <td>1066.667</td>\n",
       "      <td>-1.000</td>\n",
       "      <td>2.000</td>\n",
       "      <td>2016.000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>1.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>1.000</td>\n",
       "      <td>1.000</td>\n",
       "      <td>40.752</td>\n",
       "      <td>-73.978</td>\n",
       "      <td>3150.000</td>\n",
       "      <td>1500.000</td>\n",
       "      <td>1383.417</td>\n",
       "      <td>0.000</td>\n",
       "      <td>2.000</td>\n",
       "      <td>2016.000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>2.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>1.000</td>\n",
       "      <td>2.000</td>\n",
       "      <td>40.774</td>\n",
       "      <td>-73.955</td>\n",
       "      <td>4100.000</td>\n",
       "      <td>1850.000</td>\n",
       "      <td>1962.500</td>\n",
       "      <td>0.000</td>\n",
       "      <td>4.000</td>\n",
       "      <td>2016.000</td>\n",
       "      <td>...</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>2.000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>10.000</td>\n",
       "      <td>8.000</td>\n",
       "      <td>44.883</td>\n",
       "      <td>0.000</td>\n",
       "      <td>4490000.000</td>\n",
       "      <td>2245000.000</td>\n",
       "      <td>1496666.667</td>\n",
       "      <td>8.000</td>\n",
       "      <td>13.500</td>\n",
       "      <td>2016.000</td>\n",
       "      <td>...</td>\n",
       "      <td>1.000</td>\n",
       "      <td>1.000</td>\n",
       "      <td>1.000</td>\n",
       "      <td>2.000</td>\n",
       "      <td>1.000</td>\n",
       "      <td>1.000</td>\n",
       "      <td>1.000</td>\n",
       "      <td>1.000</td>\n",
       "      <td>1.000</td>\n",
       "      <td>2.000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8 rows × 225 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       bathrooms  bedrooms  latitude  longitude       price  price_bathrooms  \\\n",
       "count  49352.000 49352.000 49352.000  49352.000   49352.000        49352.000   \n",
       "mean       1.212     1.542    40.742    -73.956    3830.174         1697.863   \n",
       "std        0.501     1.115     0.639      1.178   22066.866        11004.769   \n",
       "min        0.000     0.000     0.000   -118.271      43.000           21.500   \n",
       "25%        1.000     1.000    40.728    -73.992    2500.000         1225.000   \n",
       "50%        1.000     1.000    40.752    -73.978    3150.000         1500.000   \n",
       "75%        1.000     2.000    40.774    -73.955    4100.000         1850.000   \n",
       "max       10.000     8.000    44.883      0.000 4490000.000      2245000.000   \n",
       "\n",
       "       price_bedrooms  room_diff  room_num      Year       ...        \\\n",
       "count       49352.000  49352.000 49352.000 49352.000       ...         \n",
       "mean         1657.567     -0.329     2.754  2016.000       ...         \n",
       "std          7817.996      0.948     1.446     0.000       ...         \n",
       "min            43.000     -5.000     0.000  2016.000       ...         \n",
       "25%          1066.667     -1.000     2.000  2016.000       ...         \n",
       "50%          1383.417      0.000     2.000  2016.000       ...         \n",
       "75%          1962.500      0.000     4.000  2016.000       ...         \n",
       "max       1496666.667      8.000    13.500  2016.000       ...         \n",
       "\n",
       "           walk     walls       war    washer     water  wheelchair      wifi  \\\n",
       "count 49352.000 49352.000 49352.000 49352.000 49352.000   49352.000 49352.000   \n",
       "mean      0.003     0.000     0.186     0.009     0.000       0.028     0.002   \n",
       "std       0.055     0.020     0.389     0.102     0.021       0.165     0.045   \n",
       "min       0.000     0.000     0.000     0.000     0.000       0.000     0.000   \n",
       "25%       0.000     0.000     0.000     0.000     0.000       0.000     0.000   \n",
       "50%       0.000     0.000     0.000     0.000     0.000       0.000     0.000   \n",
       "75%       0.000     0.000     0.000     0.000     0.000       0.000     0.000   \n",
       "max       1.000     1.000     1.000     2.000     1.000       1.000     1.000   \n",
       "\n",
       "        windows      work  interest_level  \n",
       "count 49352.000 49352.000       49352.000  \n",
       "mean      0.001     0.001           1.617  \n",
       "std       0.032     0.031           0.626  \n",
       "min       0.000     0.000           0.000  \n",
       "25%       0.000     0.000           1.000  \n",
       "50%       0.000     0.000           2.000  \n",
       "75%       0.000     0.000           2.000  \n",
       "max       1.000     1.000           2.000  \n",
       "\n",
       "[8 rows x 225 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "train.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0,0.5,'Number of occurrences')"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZUAAAELCAYAAAARNxsIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdG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C56W4pKBCDpqfL5LknXSbpC0s8kfVOVTwJ/\nAFwr6drS9khJN0m6XdK3yqSCSHpA0jmSbgCOl/RqST+UdJuk/y3ptaXd8ZLulnSHpOvLFDvnAh8q\nT2Z/qEbefZK+LWl1WQ6XtEfJYWJLuwFJB7Zr3/g/zBjX9ux2AhG7oDcDr6ealPNG4HDbF0n6FPBu\n249I2h/4a+C9tn8j6bPAp6iKAsDvbP8pgKRrgFNt3yfpMOBrwBHAOcBRtn8laaLtZySdA/TbPr1m\nrl8BLrR9g6SDgJW2XyfpKuADwNfLdz5g+2FJ/zq8PfC6F/jPK+L3UlQitnWr7UEASWuB6cANw9rM\nAg4BbqzmFGRvqvm7hlxejn8p8A7gW6UdwD7l80bgUknLgLHObvte4JCWc7+8vIHwcqqi9XWqCUYv\nH6V9RCNSVCK29XTL+hba/3siYJXtE7dzjt+Uzz2Ax2zPHN7A9qnlKuJ9wFpJ27SpYQ/g7bb/31bJ\nSTcBr5HUB8wFzh+l/Ri+OmJb6VOJqO9JYOj/6m8GDpf0GgBJL5b0R8MPKC9s+oWk40s7SXpTWX+1\n7VtsnwM8QvVOnNbvqONHVDNUU845s3yvge8AX6aalv3XI7WPaEqKSkR9C4GrJV1rexPwUeAySXdS\nFZnXbue4DwOnSLoDWAfMKfEvSrpL0t3A9cAdwLVUt6dqddQDnwT6Jd0p6R7g1JZ9lwN/yfO3vkZr\nH/GCZer7iIhoTK5UIiKiMemoj9hFSToZOGNY+Ebbp3Ujn4g6cvsrIiIak9tfERHRmBSViIhoTIpK\nREQ0JkUlIiIak6ISERGN+f+UQGoL+CmGNwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1131947f0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "# Target 分布, 看看各类样本分布是否均衡\n",
    "sns.countplot(train.interest_level)\n",
    "pyplot.xlabel('interest_level')\n",
    "pyplot.ylabel('Number of occurrences')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "各类样本很不均衡. 交叉验证对分类任务缺省的是采用 StratifiedKFold，在每折采样时根据各类样本按比例采样."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>listing_id</th>\n",
       "      <th>bathrooms</th>\n",
       "      <th>bedrooms</th>\n",
       "      <th>latitude</th>\n",
       "      <th>longitude</th>\n",
       "      <th>price</th>\n",
       "      <th>price_bathrooms</th>\n",
       "      <th>price_bedrooms</th>\n",
       "      <th>room_diff</th>\n",
       "      <th>room_num</th>\n",
       "      <th>...</th>\n",
       "      <th>virtual</th>\n",
       "      <th>walk</th>\n",
       "      <th>walls</th>\n",
       "      <th>war</th>\n",
       "      <th>washer</th>\n",
       "      <th>water</th>\n",
       "      <th>wheelchair</th>\n",
       "      <th>wifi</th>\n",
       "      <th>windows</th>\n",
       "      <th>work</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>7142618</td>\n",
       "      <td>1.000</td>\n",
       "      <td>1</td>\n",
       "      <td>40.718</td>\n",
       "      <td>-73.987</td>\n",
       "      <td>2950</td>\n",
       "      <td>1475.000</td>\n",
       "      <td>1475.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>2.000</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>7210040</td>\n",
       "      <td>1.000</td>\n",
       "      <td>2</td>\n",
       "      <td>40.728</td>\n",
       "      <td>-74.000</td>\n",
       "      <td>2850</td>\n",
       "      <td>1425.000</td>\n",
       "      <td>950.000</td>\n",
       "      <td>-1.000</td>\n",
       "      <td>3.000</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>7103890</td>\n",
       "      <td>1.000</td>\n",
       "      <td>1</td>\n",
       "      <td>40.731</td>\n",
       "      <td>-73.989</td>\n",
       "      <td>3758</td>\n",
       "      <td>1879.000</td>\n",
       "      <td>1879.000</td>\n",
       "      <td>0.000</td>\n",
       "      <td>2.000</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>7143442</td>\n",
       "      <td>1.000</td>\n",
       "      <td>2</td>\n",
       "      <td>40.711</td>\n",
       "      <td>-73.957</td>\n",
       "      <td>3300</td>\n",
       "      <td>1650.000</td>\n",
       "      <td>1100.000</td>\n",
       "      <td>-1.000</td>\n",
       "      <td>3.000</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>6860601</td>\n",
       "      <td>2.000</td>\n",
       "      <td>2</td>\n",
       "      <td>40.765</td>\n",
       "      <td>-73.984</td>\n",
       "      <td>4900</td>\n",
       "      <td>1633.333</td>\n",
       "      <td>1633.333</td>\n",
       "      <td>0.000</td>\n",
       "      <td>4.000</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 225 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   listing_id  bathrooms  bedrooms  latitude  longitude  price  \\\n",
       "0     7142618      1.000         1    40.718    -73.987   2950   \n",
       "1     7210040      1.000         2    40.728    -74.000   2850   \n",
       "2     7103890      1.000         1    40.731    -73.989   3758   \n",
       "3     7143442      1.000         2    40.711    -73.957   3300   \n",
       "4     6860601      2.000         2    40.765    -73.984   4900   \n",
       "\n",
       "   price_bathrooms  price_bedrooms  room_diff  room_num  ...   virtual  walk  \\\n",
       "0         1475.000        1475.000      0.000     2.000  ...         0     0   \n",
       "1         1425.000         950.000     -1.000     3.000  ...         0     0   \n",
       "2         1879.000        1879.000      0.000     2.000  ...         0     0   \n",
       "3         1650.000        1100.000     -1.000     3.000  ...         0     0   \n",
       "4         1633.333        1633.333      0.000     4.000  ...         0     0   \n",
       "\n",
       "   walls  war  washer  water  wheelchair  wifi  windows  work  \n",
       "0      0    0       0      0           0     0        0     0  \n",
       "1      0    1       0      0           0     0        0     0  \n",
       "2      0    0       0      0           0     0        0     0  \n",
       "3      0    0       0      0           1     0        0     0  \n",
       "4      0    1       0      0           0     0        0     0  \n",
       "\n",
       "[5 rows x 225 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 74659 entries, 0 to 74658\n",
      "Columns: 225 entries, listing_id to work\n",
      "dtypes: float64(7), int64(218)\n",
      "memory usage: 128.2 MB\n"
     ]
    }
   ],
   "source": [
    "test.info()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 数据预处理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 提取 y, 在训练数据 X 中丢弃\n",
    "y_train = train['interest_level']\n",
    "train.drop(['interest_level'], axis=1, inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "X_train = np.array(train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "test_id = test['listing_id']\n",
    "test.drop(['listing_id'], axis=1, inplace=True)\n",
    "X_test = np.array(test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 数据标准化\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "# 初始化特征的标准化器\n",
    "ss_X = StandardScaler()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 分别对训练数据和测试数据的特征进行标准化处理\n",
    "X_train = ss_X.fit_transform(X_train)\n",
    "X_test = ss_X.transform(X_test)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 模型训练"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## default Logistic Regression"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sklearn.linear_model import LogisticRegression"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "lr = LogisticRegression()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/qi/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/base.py:340: RuntimeWarning: overflow encountered in exp\n",
      "  np.exp(prob, prob)\n",
      "/Users/qi/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/base.py:340: RuntimeWarning: overflow encountered in exp\n",
      "  np.exp(prob, prob)\n",
      "/Users/qi/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/base.py:340: RuntimeWarning: overflow encountered in exp\n",
      "  np.exp(prob, prob)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "logloss of each fold is:  [ 0.68613212  0.69391517  0.68490632  0.67816236  0.6860222   0.6742054\n",
      "  0.6685211   0.66898296  0.67455859  0.6898933 ]\n",
      "cv loss is:  0.680529951061\n"
     ]
    }
   ],
   "source": [
    "# 交叉验证用于评估模型性能和进行参数调优(模型选择)\n",
    "# 分类任务中交叉验证缺省是采用 StratifiedKFold (分层采样 K折)\n",
    "from sklearn.cross_validation import cross_val_score\n",
    "loss = cross_val_score(lr, X_train, y_train, cv=10, scoring='neg_log_loss')\n",
    "print('logloss of each fold is: ', -loss)\n",
    "print('cv loss is: ', -loss.mean())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 正则化的 Logistic Regression 及参数调优"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Logistic Regression 需要调优的超参数有: C (正则系数, 一般在 log 域(取 log 后的值), 均匀设置候选参数) 和 正则函数 penalty (L2/L1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "目标函数为: J = sum(logloss(f(xi), yi)) + C * penalty"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在 sklearn 框架下, 不同学习器的参数调优步骤相同: 设置候选参数集合, 调用GridSearchCV, 调用 fit"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "from sklearn.model_selection import GridSearchCV"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# 需要调优的参数\n",
    "penalty = ['l1']\n",
    "Cs = [1, 10, 100, 1000]\n",
    "\n",
    "tuned_parameters = dict(penalty=penalty, C=Cs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true,
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "lr_penalty = LogisticRegression()\n",
    "grid = GridSearchCV(lr_penalty, tuned_parameters, cv=5, scoring='neg_log_loss', n_jobs=-1, pre_dispatch=4)\n",
    "grid.fit(X_train[0:3999], y_train[0:3999])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/qi/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('mean_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n",
      "/Users/qi/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('split0_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n",
      "/Users/qi/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('split1_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n",
      "/Users/qi/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('split2_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n",
      "/Users/qi/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('split3_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n",
      "/Users/qi/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('split4_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n",
      "/Users/qi/anaconda3/lib/python3.6/site-packages/sklearn/utils/deprecation.py:122: FutureWarning: You are accessing a training score ('std_train_score'), which will not be available by default any more in 0.21. If you need training scores, please set return_train_score=True\n",
      "  warnings.warn(*warn_args, **warn_kwargs)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "{'mean_fit_time': array([   0.13627062,    0.1546874 ,    0.63902845,    4.90874128,\n",
       "          25.06104388,   83.68735189,  113.85484724]),\n",
       " 'mean_score_time': array([ 0.00514183,  0.00371094,  0.00197253,  0.00157633,  0.00157151,\n",
       "         0.0016223 ,  0.00151401]),\n",
       " 'mean_test_score': array([-1.04325143, -0.79034616, -0.74774857, -0.78564641, -0.92766134,\n",
       "        -0.99380778, -1.06761922]),\n",
       " 'mean_train_score': array([-1.04320516, -0.78791156, -0.69787457, -0.63475706, -0.62742918,\n",
       "        -0.62591596, -0.62581106]),\n",
       " 'param_C': masked_array(data = [0.001 0.01 0.1 1 10 100 1000],\n",
       "              mask = [False False False False False False False],\n",
       "        fill_value = ?),\n",
       " 'param_penalty': masked_array(data = ['l1' 'l1' 'l1' 'l1' 'l1' 'l1' 'l1'],\n",
       "              mask = [False False False False False False False],\n",
       "        fill_value = ?),\n",
       " 'params': [{'C': 0.001, 'penalty': 'l1'},\n",
       "  {'C': 0.01, 'penalty': 'l1'},\n",
       "  {'C': 0.1, 'penalty': 'l1'},\n",
       "  {'C': 1, 'penalty': 'l1'},\n",
       "  {'C': 10, 'penalty': 'l1'},\n",
       "  {'C': 100, 'penalty': 'l1'},\n",
       "  {'C': 1000, 'penalty': 'l1'}],\n",
       " 'rank_test_score': array([6, 3, 1, 2, 4, 5, 7], dtype=int32),\n",
       " 'split0_test_score': array([-1.04337592, -0.79459915, -0.76283973, -0.80463892, -1.06821867,\n",
       "        -1.12960579, -1.22014229]),\n",
       " 'split0_train_score': array([-1.04327436, -0.78519685, -0.69389424, -0.63066823, -0.62272885,\n",
       "        -0.62099329, -0.62085169]),\n",
       " 'split1_test_score': array([-1.04329657, -0.78899463, -0.74346387, -0.74233326, -0.85015757,\n",
       "        -0.93690634, -1.01266056]),\n",
       " 'split1_train_score': array([-1.04311773, -0.78954249, -0.69820932, -0.63412217, -0.62585889,\n",
       "        -0.62396714, -0.6238455 ]),\n",
       " 'split2_test_score': array([-1.04328805, -0.79045635, -0.75451557, -0.82405202, -0.92670996,\n",
       "        -0.97331109, -0.98851631]),\n",
       " 'split2_train_score': array([-1.04311887, -0.78751009, -0.6968963 , -0.6346607 , -0.62693396,\n",
       "        -0.62554119, -0.62544777]),\n",
       " 'split3_test_score': array([-1.04320981, -0.7881755 , -0.73220467, -0.78623345, -0.86967686,\n",
       "        -0.93134369, -1.03685625]),\n",
       " 'split3_train_score': array([-1.04320803, -0.78835561, -0.69979985, -0.63478463, -0.62870616,\n",
       "        -0.62752667, -0.62744505]),\n",
       " 'split4_test_score': array([-1.0430864 , -0.7894961 , -0.74567814, -0.77093299, -0.92329003,\n",
       "        -0.99762896, -1.07970668]),\n",
       " 'split4_train_score': array([-1.04330681, -0.78895277, -0.70057315, -0.63954959, -0.63291803,\n",
       "        -0.6315515 , -0.63146532]),\n",
       " 'std_fit_time': array([  8.26029117e-03,   2.36413393e-02,   3.04803528e-01,\n",
       "          1.11001808e+00,   4.67335484e+00,   3.58163070e+01,\n",
       "          2.81591393e+01]),\n",
       " 'std_score_time': array([  5.66918125e-04,   9.85357415e-04,   5.27818277e-04,\n",
       "          3.80122069e-05,   7.88767936e-05,   1.03093649e-04,\n",
       "          9.89779333e-05]),\n",
       " 'std_test_score': array([  9.78161808e-05,   2.25314442e-03,   1.03721286e-02,\n",
       "          2.80347189e-02,   7.63847808e-02,   7.21664983e-02,\n",
       "          8.20604761e-02]),\n",
       " 'std_train_score': array([  7.77426804e-05,   1.51473259e-03,   2.36224870e-03,\n",
       "          2.83196002e-03,   3.36340190e-03,   3.53623474e-03,\n",
       "          3.55615888e-03])}"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看完整结果\n",
    "grid.cv_results_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.747748572614\n",
      "{'C': 0.1, 'penalty': 'l1'}\n"
     ]
    }
   ],
   "source": [
    "# 最好模型\n",
    "print(-grid.best_score_)\n",
    "print(grid.best_params_)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 用 LogisticRegressionCV 实现正则化的 Logistic Regression"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### L1 正则"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LogisticRegressionCV(Cs=[0.01, 0.1, 1, 10, 100, 1000], class_weight=None,\n",
       "           cv=5, dual=False, fit_intercept=True, intercept_scaling=1.0,\n",
       "           max_iter=100, multi_class='ovr', n_jobs=-1, penalty='l1',\n",
       "           random_state=None, refit=True, scoring='neg_log_loss',\n",
       "           solver='liblinear', tol=0.0001, verbose=0)"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.linear_model import LogisticRegressionCV\n",
    "\n",
    "Cs = [0.01, 0.1, 1, 10, 100, 1000]\n",
    "\n",
    "# 大量样本, 高维度, L1正则 --> 可选用 saga 优化求解器\n",
    "# LogisticRegressionCV 比 GridSearchCV 快\n",
    "lrcv_L1 = LogisticRegressionCV(Cs=Cs, cv=5, scoring='neg_log_loss', penalty='l1', solver='liblinear', multi_class='ovr', n_jobs=-1)\n",
    "lrcv_L1.fit(X_train[:1999], y_train[:1999])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3XmcFPWd//HXh+G+72tguERuwWQC\nuriKVyBGQSVr1Byay80mZnNpxGNjRJOYbBI3m3UTjxDz20008UBQcRGjxqhRGWS4BkEOgWEAkeGe\ngWFmPr8/ukaboWAamOrq6X4/H49+0FVd1f1pGebtt+r7qTJ3R0RE5FiaxV2AiIhkPoWFiIg0SGEh\nIiINUliIiEiDFBYiItIghYWIiDRIYSEiIg1SWIiISIMUFiIi0qDmcRfQWLp37+4DBw6MuwwRkSZl\n0aJF77t7j4a2y5qwGDhwIEVFRXGXISLSpJjZhlS202EoERFpkMJCREQapLAQEZEGRRoWZjbFzFaZ\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697jCeDmHLlHujQBmg0l0vieDm5I0xK4Mxhx4O6VZnY7ift/bzzazsENmp5U\nUEgm0chCREQapHMWIiLSIIWFiIg0SGEhIiINUliIiEiDFBYiItIghYWIiDTo/wNjTe3TjBEmBQAA\nAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1a0db9c278>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "n_Cs = len(Cs)\n",
    "n_classes = 3\n",
    "scores = np.zeros((n_classes, n_Cs))\n",
    "\n",
    "for j in range(n_classes):\n",
    "    scores[j][:] = np.mean(lrcv_L1.scores_[j], axis=0)\n",
    "    \n",
    "mse_mean = -np.mean(scores, axis=0)\n",
    "pyplot.plot(np.log10(Cs), mse_mean.reshape(n_Cs, 1))\n",
    "pyplot.xlabel('log(C)')\n",
    "pyplot.ylabel('neg-logloss')\n",
    "pyplot.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在 C=0.1 处表现最好."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{0: array([[-0.30739414, -0.28364392, -0.27915919, -0.29464118, -0.31296153,\n",
       "         -0.48574176],\n",
       "        [-0.30612974, -0.27115269, -0.28761289, -0.31423977, -0.33162505,\n",
       "         -0.52722594],\n",
       "        [-0.30878242, -0.27717846, -0.28352296, -0.30642243, -0.34221781,\n",
       "         -0.36850052],\n",
       "        [-0.30322027, -0.27308499, -0.31401815, -0.37785794, -0.44574409,\n",
       "         -0.51907922],\n",
       "        [-0.30414139, -0.2743943 , -0.25219057, -0.25382794, -0.26525285,\n",
       "         -0.27950065]]),\n",
       " 1: array([[-0.56263676, -0.55145827, -0.54794839, -0.56823048, -0.58986857,\n",
       "         -0.90334223],\n",
       "        [-0.56262782, -0.54362896, -0.55340613, -0.66872012, -0.7789763 ,\n",
       "         -0.97090767],\n",
       "        [-0.56118474, -0.5411046 , -0.63200902, -0.77412222, -0.87146702,\n",
       "         -1.02115163],\n",
       "        [-0.56162646, -0.53778705, -0.54833964, -0.59154628, -0.673801  ,\n",
       "         -0.7362706 ],\n",
       "        [-0.56207383, -0.53717575, -0.54898827, -0.57827781, -0.62212403,\n",
       "         -0.67493198]]),\n",
       " 2: array([[-0.63222633, -0.59362401, -0.55898906, -0.58050198, -0.64196002,\n",
       "         -1.05462072],\n",
       "        [-0.63336013, -0.59331633, -0.5732661 , -0.6340699 , -0.69841542,\n",
       "         -0.82342649],\n",
       "        [-0.63163232, -0.59533351, -0.65678193, -0.76415603, -0.86690371,\n",
       "         -1.135702  ],\n",
       "        [-0.63511748, -0.58534549, -0.59161651, -0.66112152, -0.72237599,\n",
       "         -0.80950363],\n",
       "        [-0.63140878, -0.59319759, -0.60042551, -0.67804891, -0.74134199,\n",
       "         -0.90045072]])}"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lrcv_L1.scores_"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### L2 正则"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LogisticRegressionCV(Cs=[0.01, 0.1, 1, 10, 100, 1000], class_weight=None,\n",
       "           cv=5, dual=False, fit_intercept=True, intercept_scaling=1.0,\n",
       "           max_iter=100, multi_class='ovr', n_jobs=-1, penalty='l2',\n",
       "           random_state=None, refit=True, scoring='neg_log_loss',\n",
       "           solver='liblinear', tol=0.0001, verbose=0)"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.linear_model import LogisticRegressionCV\n",
    "Cs = [0.01, 0.1, 1, 10, 100, 1000]\n",
    "\n",
    "lrcv_L2 = LogisticRegressionCV(Cs=Cs, cv=5, scoring='neg_log_loss', penalty='l2', solver='liblinear', multi_class='ovr', n_jobs=-1)\n",
    "lrcv_L2.fit(X_train[:1999], y_train[:1999])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{0: array([[-0.34141407, -0.32568811, -0.33538109, -0.35786995, -0.39639544,\n",
       "         -0.42624654],\n",
       "        [-0.32604407, -0.33291798, -0.36817062, -0.40834087, -0.43985653,\n",
       "         -0.45672087],\n",
       "        [-0.33423629, -0.31691667, -0.32399729, -0.33742662, -0.36392013,\n",
       "         -0.393501  ],\n",
       "        [-0.31108145, -0.31213092, -0.35982114, -0.40991671, -0.47306333,\n",
       "         -0.54634194],\n",
       "        [-0.34488117, -0.34633731, -0.35270074, -0.35330143, -0.36975914,\n",
       "         -0.3805916 ]]),\n",
       " 1: array([[-0.5766558 , -0.60636217, -0.62910475, -0.65489315, -0.68655325,\n",
       "         -0.71756114],\n",
       "        [-0.55280668, -0.57710438, -0.62731959, -0.70295126, -0.7954464 ,\n",
       "         -0.87800599],\n",
       "        [-0.57274751, -0.6200455 , -0.6911726 , -0.77159635, -0.85945032,\n",
       "         -0.94087032],\n",
       "        [-0.56997129, -0.58655692, -0.61716525, -0.66670463, -0.72084375,\n",
       "         -0.76975543],\n",
       "        [-0.57999249, -0.590667  , -0.60229849, -0.62883631, -0.64457982,\n",
       "         -0.65708907]]),\n",
       " 2: array([[-0.61219031, -0.6249594 , -0.62769831, -0.65178109, -0.6822253 ,\n",
       "         -0.70661991],\n",
       "        [-0.59351338, -0.61412426, -0.62863448, -0.66005651, -0.69938503,\n",
       "         -0.73946697],\n",
       "        [-0.63043471, -0.69084276, -0.75283273, -0.82740566, -0.91865395,\n",
       "         -1.01083987],\n",
       "        [-0.61356372, -0.64554461, -0.68676976, -0.7551689 , -0.8308737 ,\n",
       "         -0.91672585],\n",
       "        [-0.62949044, -0.6530497 , -0.67069267, -0.72340009, -0.78591738,\n",
       "         -0.82644499]])}"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lrcv_L2.scores_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZIAAAEKCAYAAAA4t9PUAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3XeYVeW5/vHvw1CllwGRIqCDICDF\nTVGMBVE5ngSJLahEsAQ1IeovibGc5ESNacccPRKxoCBqVFBsGDVEAQs2GHqHYRAZ2gx9KDNMeX5/\n7IXZmQzMHmbW7Cn357r25V5rve/azzKB21Xed5m7IyIicrxqJboAERGp2hQkIiJSJgoSEREpEwWJ\niIiUiYJERETKREEiIiJlEmqQmNkwM1tjZmlmdk8x2x81s8XBZ62Z7YnZNtrM1gWf0THrzzSzZcE+\nx5uZhXkMIiJybBbWOBIzSwLWAhcBGcB84Bp3X3mU9j8F+rr7jWbWAkgFIoADC4Az3X23mc0D7gC+\nBN4Dxrv7+6EchIiIlCjMM5IBQJq7p7v7YWAqcNkx2l8DvBJ8vwT4wN13uftu4ANgmJm1BZq4+xce\nTcAXgBHhHYKIiJSkdoj7bgdsilnOAAYW19DMTgY6A7OP0bdd8MkoZv0xtWrVyjt16hRv3SIiAixY\nsGCHuyeX1C7MICnu3sXRrqONBKa7e0EJfePep5mNBcYCdOzYkdTU1GNXKyIi/8LMNsbTLsxLWxlA\nh5jl9sCWo7QdyT8vax2rb0bwvcR9uvtEd4+4eyQ5ucRAFRGR4xRmkMwHUsyss5nVJRoWM4o2MrPT\ngObAFzGrZwIXm1lzM2sOXAzMdPetQLaZDQqe1roeeDvEYxARkRKEdmnL3fPNbBzRUEgCJrv7CjN7\nEEh19yOhcg0w1WMeH3P3XWb2W6JhBPCgu+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FEoSETKkUU9bGbLzWyZmf0gWF/LzJ4IzjD+ZmbvmdmV\nQbfrgCPzuZ0CDAR+5e6FAMHsxO8Gbd8K2otUGjpFFilflxN9/0NvoBUw38w+ITq6uhPQC2hNdCT9\n5KDPYOCV4HsPYHEw4V5xlgP9Q6lc5DjpjESkfJ0DvOLuBe6+HfiY6F/85wCvuXuhu28D5sT0aQtk\nxbPzIGAOm1njcq5b5LgpSETKV3FT0x9rPcAhoH7wfQXQ28yO9WezHpBzHLWJhEJBIlK+PgF+ELxU\nKBk4F5gHzAWuCO6VtAHOj+mzCjgVwN3XA6nAA8GstZhZipldFnxvCWS5e15FHZBISRQkIuXrTWAp\nsASYDfwyuJT1OtH3nywHnib6hr69QZ93+ddguZnoC8fSzGwZ8Az/fE/KBcB74R6CSOlo9l+RCmJm\njdx9f3BWMQ8Y7O7bgvdFzAmWj3aT/cg+3gDudfc1FVCySFz01JZIxflb8LKhusBvgzMV3P2Qmf2G\n6Pvivzla5+DlW28pRKSy0RmJiIiUie6RiIhImShIRESkTBQkIiJSJgoSEREpEwWJiIiUiYJERETK\n5P8DYQrOHd1i3KEAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1a18a0e160>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "n_Cs = len(Cs)\n",
    "n_classes = 3\n",
    "scores = np.zeros((n_classes, n_Cs))\n",
    "\n",
    "for j in range(n_classes):\n",
    "    scores[j][:] = np.mean(lrcv_L2.scores_[j], axis=0)\n",
    "    \n",
    "mse_mean = -np.mean(scores, axis=0)\n",
    "pyplot.plot(np.log10(Cs), mse_mean.reshape(n_Cs, 1))\n",
    "pyplot.xlabel('log(C)')\n",
    "pyplot.ylabel('neg-logloss')\n",
    "pyplot.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LogisticRegressionCV(Cs=[1e-05, 0.0001, 0.001, 0.01], class_weight=None, cv=5,\n",
       "           dual=False, fit_intercept=True, intercept_scaling=1.0,\n",
       "           max_iter=100, multi_class='ovr', n_jobs=-1, penalty='l2',\n",
       "           random_state=None, refit=True, scoring='neg_log_loss',\n",
       "           solver='liblinear', tol=0.0001, verbose=0)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Cs = [0.00001, 0.0001, 0.001, 0.01]\n",
    "lrcv_L2 = LogisticRegressionCV(Cs=Cs, cv=5, scoring='neg_log_loss', penalty='l2', solver='liblinear', multi_class='ovr', n_jobs=-1)\n",
    "lrcv_L2.fit(X_train[:1999], y_train[:1999])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{0: array([[-0.6852168 , -0.62707519, -0.44728066, -0.34141407],\n",
       "        [-0.6850385 , -0.62511669, -0.43588938, -0.32604407],\n",
       "        [-0.68538714, -0.62822507, -0.44923032, -0.33423629],\n",
       "        [-0.68484355, -0.62366225, -0.43170686, -0.31108145],\n",
       "        [-0.68495513, -0.62520551, -0.44473002, -0.34488117]]),\n",
       " 1: array([[-0.68984729, -0.66589642, -0.59656899, -0.5766558 ],\n",
       "        [-0.68984954, -0.66565797, -0.58982898, -0.55280668],\n",
       "        [-0.68981502, -0.66571139, -0.59594069, -0.57274751],\n",
       "        [-0.68994604, -0.66674249, -0.59901216, -0.56997129],\n",
       "        [-0.69008904, -0.66796525, -0.60492585, -0.57999249]]),\n",
       " 2: array([[-0.69106554, -0.6758981 , -0.63020163, -0.61219031],\n",
       "        [-0.69080749, -0.67362157, -0.61788609, -0.59351338],\n",
       "        [-0.69102916, -0.67580232, -0.63274881, -0.63043471],\n",
       "        [-0.69098213, -0.67530611, -0.62861152, -0.61356372],\n",
       "        [-0.69116235, -0.67683733, -0.63580176, -0.62949044]])}"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "lrcv_L2.scores_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZIAAAEKCAYAAAA4t9PUAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAIABJREFUeJzt3Xl8VdW5//HPk4QkDGEOQxgEMagI\nAhKC86ylVsHWCesAClJtrdW2Wr3trfdqvb2tP6u1tU6gOFXrDA4VZxwqQ9CEGYwgEgIS5jBkIs/v\nj7PxHtNADiSHfZJ836/XeXHOPmvvPMsj+bLPXnstc3dERET2V1LYBYiISOOmIBERkXpRkIiISL0o\nSEREpF4UJCIiUi8KEhERqRcFiYiI1IuCRERE6kVBIiIi9ZISdgEHQufOnb1Pnz5hlyEi0qjMnTt3\nvbtn1tWuWQRJnz59yMvLC7sMEZFGxcxWxtJOX22JiEi9KEhERKReFCQiIlIvChIREakXBYmIiNSL\ngkREROpFQSIiIvXSLO4j2V8vfVZEWWU13x3YjfatUsMuR0QkISlI9uKVgjW8u2Qdv526gJP6ZzJq\nSA9OP7wLrVL1n01EZDf9RtyLyWNzWFi8lan5q3mlYA1vL15HyxbJnDGgK6OHZHFCdiapKfp2UESa\nN3P3sGuIu5ycHK/vFCnV1c7sLzcyraCY1+evYfOOStq3asF3B3Zn1OAsRvTtSFKSNVDFIiLhM7O5\n7p5TZzsFyb6rqKrmo8ISpuUX8+air9lRsYuubdM458gsRg3JYlCPdpgpVESkcVOQRGnoIIm2o6KK\ndxavY2p+MTOWraNyl9O3c2vOGZzFqMFZHNKlTVx+rohIvClIosQzSKJt2VHJGwvXMDW/mE+Wb8Ad\njshqy6jBWZwzOIus9i3jXoOISENRkEQ5UEES7eutZbw6bw3T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vbVoDGVHP/wWMDLv2/ehHg//+Cr3jifYAngDmA/OITHvfPdieBbwe1e4sYBmRfyX+\nOuy6Y+jXN798gRxgUvD82KC/BcGf48OudX/7Ery+EigMHleEXWsttb8ALAj+/3oF6NFYP5NY+tIY\nPpOgxkIi1w3yg8cDwfZv/t4TGeVUEDwWJuLf+1j6Ebxu0N9furNdRETqRaO2RESkXhQkIiJSLwoS\nERGpFwWJiIjUi4JERETqRUEi0gDMbFs9938+uIsdM2tjZg+a2RdmttDMPjCzEWaWGjxvljcSS+JS\nkIiEzMyOAJLdfXmwaRKwkcgNf0cA44jcN1MBvANcFEqhInugIBFpQBZxp5ktCNatuCjYnmRmfwvO\nMF41s9fN7Pxgt0uA3XMk9QNGAL9x92qITJPi7q8FbV8O2oskDJ0iizSsHwBDgMFEpjeZY2YfAMcB\nfYBBQBdgMfBIsM9xwNPB8yOAfHfftYfjLwCGx6Vykf2kMxKRhnU88LS773L3r4EZRH7xHw885+7V\nHplo8r2ofboDJbEcPAiYCjPLaOC6RfabgkSkYdU2RffetgPsBNKD5wuBwWa2t7+baUDZftQmEhcK\nEpGG9QFwkZklm1kmcCIwG/gIOC+4VtKVb0+tvhg4BMAja47kAf9twZz5ZpZtZqOD552AEnevPFAd\nEqmLgkSkYb1EZDbcAuBd4Kbgq6wXiKwDsQB4EJgFbAn2eY1vB8sEIgsXFZrZfOBh/m+9iFOA1+Pb\nBZF9o9l/RQ4QM2vj7tuCs4rZRFbbW2tmLYlcMzluLxfZdx/jReAWd196AEoWiYlGbYkcOK+aWXsi\niwndHpyp4O47zexWIutmf7Wnnc0sFXhZISKJRmckIiJSL7pGIiIi9aIgERGRelGQiIhIvShIRESk\nXhQkIiJSLwoSERGpl/8PEhZoH93PxI8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1a19693be0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "n_Cs = len(Cs)\n",
    "n_classes = 3\n",
    "scores = np.zeros((n_classes, n_Cs))\n",
    "for j in range(n_classes):\n",
    "    scores[j][:] = np.mean(lrcv_L2.scores_[j], axis=0)\n",
    "    \n",
    "mse_mean = -np.mean(scores, axis=0)\n",
    "pyplot.plot(np.log10(Cs), mse_mean.reshape(n_Cs, 1))\n",
    "pyplot.xlabel('log(C)')\n",
    "pyplot.ylabel('neg-logloss')\n",
    "pyplot.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "在 C=0.01 处表现最好."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 模型预测"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "LogisticRegressionCV在参数范围边缘(C=0.1)处取得极值. penalty 取'l1'表现更好."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/Users/qi/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/base.py:340: RuntimeWarning: overflow encountered in exp\n",
      "  np.exp(prob, prob)\n",
      "/Users/qi/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/base.py:340: RuntimeWarning: overflow encountered in exp\n",
      "  np.exp(prob, prob)\n",
      "/Users/qi/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/base.py:340: RuntimeWarning: overflow encountered in exp\n",
      "  np.exp(prob, prob)\n",
      "/Users/qi/anaconda3/lib/python3.6/site-packages/sklearn/linear_model/base.py:340: RuntimeWarning: overflow encountered in exp\n",
      "  np.exp(prob, prob)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "LogisticRegressionCV(Cs=[0.1], class_weight=None, cv=5, dual=False,\n",
       "           fit_intercept=True, intercept_scaling=1.0, max_iter=100,\n",
       "           multi_class='ovr', n_jobs=-1, penalty='l1', random_state=None,\n",
       "           refit=True, scoring='neg_log_loss', solver='liblinear',\n",
       "           tol=0.0001, verbose=0)"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.linear_model import LogisticRegressionCV\n",
    "Cs = [0.1]\n",
    "lrcv = LogisticRegressionCV(Cs=Cs, cv=5, scoring='neg_log_loss', penalty='l1', solver='liblinear', multi_class='ovr', n_jobs=-1)\n",
    "lrcv.fit(X_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "y_predict = lrcv.predict(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0,0.5,'Number of occurrences')"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZUAAAELCAYAAAARNxsIAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4wLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvpW3flQAAG0xJREFUeJzt3X2wXVWd5vHvEyKKL5hEAhWT0EFN\nq4htgCtE6bJVFALOEGSkhXFMmk5N1AKFoqdHcBxSgnZr22obX5hJNZHEUSCiNNEOxnQEHBEwAXkL\nyOSKSm4nTQLhJcCIAz7zx14XTpKTe3du9snhJM+n6tTZ+3fWXud3uKZ+7r3WXlu2iYiIaMKobicQ\nERF7jhSViIhoTIpKREQ0JkUlIiIak6ISERGNSVGJiIjGpKhERERjUlQiIqIxKSoREdGY0d1OYHc7\n4IADPGXKlG6nERHRM2655ZYHbY+v03avKypTpkxh9erV3U4jIqJnSPpt3ba5/BUREY1JUYmIiMak\nqERERGNSVCIiojEpKhER0ZgUlYiIaEzHioqk10q6reX1mKRzJI2TtELS2vI+trSXpPmS+iXdIemI\nlr5ml/ZrJc1uiR8p6c5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3fBRza0vf+5QmEV1AVrW9QLTB6xTDtIxqRohKxvada\ntp+h/b8TAStsn76DPp4o76OAR2xP27aB7Q+Xs4j3ALdJ2q5NDaOAt9j+v1slJ90IvEbSeOBk4NPD\ntB/BV0dsL2MqEfVtAQb/X/1NwDGSXgMg6cWS/njbA8oDm34t6dTSTpLeVLZfbftm2xcAD1I9E6f1\nO+r4EdUK1ZQ+p5XvNXAV8EWqZdkfGqp9RFNSVCLqWwBcI+la25uAvwAuk3QHVZF53Q6O+wAwR9Lt\nwBpgZol/XtKdku4CfgLcDlxLdXmq1kA98DGgT9Idku4GPtzy2RXAf+K5S1/DtY/YZVn6PiIiGpMz\nlYiIaEwG6iOepySdAZy9TfgG22d2I5+IOnL5KyIiGpPLXxER0ZgUlYiIaEyKSkRENCZFJSIiGpOi\nEhERjfn/6Rp1ZsqFuL8AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1a0e6b5eb8>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "sns.countplot(y_predict)\n",
    "pyplot.xlabel('interest_level')\n",
    "pyplot.ylabel('Number of occurrences')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "直观上, 预测结果中 0 类(high)和 1 类(medium)比例太低."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "result = pd.DataFrame({'listing_id':test_id, 'interest_level_predict':y_predict})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "result.to_csv('LRresults_RentalListingInquiries.csv',index=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
